package com.muatocroi.tornado;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ScreenActivity extends ActivityMCAbstractClass implements OnClickListener {
	SignalSender sender = null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_screen);
		
		Button btnScrOff = (Button) findViewById(R.id.btnScrOff);
		btnScrOff.setOnClickListener(this);
		
		Button btnScrOn = (Button) findViewById(R.id.btnscrOn);
		btnScrOn.setOnClickListener(this);
		
		Button btnscrSaver = (Button) findViewById(R.id.btnscrSaver);
		btnscrSaver.setOnClickListener(this);
		
		Button btnComputerOnly = (Button) findViewById(R.id.btnComputerOnly);
		btnComputerOnly.setOnClickListener(this);
		
		Button btnDouplicate = (Button) findViewById(R.id.btnDouplicate);
		btnDouplicate.setOnClickListener(this);
		
		Button btnExtend = (Button) findViewById(R.id.btnExtend);
		btnExtend.setOnClickListener(this);
		
		Button btnProjectorOnly = (Button) findViewById(R.id.btnProjectorOnly);
		btnProjectorOnly.setOnClickListener(this);
		////
		
		Button btnScreenZoomIn = (Button) findViewById(R.id.btnScreenZoomIn);
		btnScreenZoomIn.setOnClickListener(this);
		
		Button btnScreenZoomOut = (Button) findViewById(R.id.btnScreenZoomOut);
		btnScreenZoomOut.setOnClickListener(this);
		
		Button btnScreenZoomFullScreen = (Button) findViewById(R.id.btnScreenZoomFullScreen);
		btnScreenZoomFullScreen.setOnClickListener(this);
		
		Button btnScreenZoomDocked = (Button) findViewById(R.id.btnScreenZoomDocked);
		btnScreenZoomDocked.setOnClickListener(this);

		Button btnScreenZoomLens = (Button) findViewById(R.id.btnScreenZoomLens);
		btnScreenZoomLens.setOnClickListener(this);
		
		Button btnScreenZoomExit = (Button) findViewById(R.id.btnScreenZoomExit);
		btnScreenZoomExit.setOnClickListener(this);
		sender = SignalSender.getSender();
		if (!sender.isSending())
		{
			sender.BeginSend();
		}
	}
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.btnScrOff:
			sender.Send(CommandScreen.ScreenOff());
			break;

		case R.id.btnscrOn:
			sender.Send(CommandScreen.ScreenOn());
			break;

		case R.id.btnscrSaver:
			sender.Send(CommandScreen.ScreenOff());
			break;

		case R.id.btnComputerOnly:
			sender.Send(CommandScreen.ComputerOnly());
			break;
			
		case R.id.btnDouplicate:
			sender.Send(CommandScreen.Douplicate());
			break;
			
		case R.id.btnExtend:
			sender.Send(CommandScreen.Extend());
			break;
			
		case R.id.btnProjectorOnly:
			sender.Send(CommandScreen.ProjectorOnly());
			break;
			
		case R.id.btnScreenZoomIn:
			sender.Send(CommandScreen.ZoomIn());
			break;
			
		case R.id.btnScreenZoomOut:
			sender.Send(CommandScreen.ZoomOut());
			break;
			
		case R.id.btnScreenZoomFullScreen:
			sender.Send(CommandScreen.ZoomFullScreen());
			break;
			
		case R.id.btnScreenZoomDocked:
			sender.Send(CommandScreen.ZoomDocked());
			break;

		case R.id.btnScreenZoomLens:
			sender.Send(CommandScreen.ZoomLens());
			break;
			
		case R.id.btnScreenZoomExit:
			sender.Send(CommandScreen.ZoomExit());
			break;
		default:
			break;
		}
	}

}
